<!-- 侧边栏组件 -->
<template>
  <div class="right-aside">
    <div class="service_item">
      <img src="@/assets/image/07.png" />
      <span></span>
      <span></span>
    </div>
    <div class="service_item">
      <img src="@/assets/image/08.png" />
    </div>
    <div class="service_item">
      <img src="@/assets/image/09.png" />
    </div>
    <div class="commom-nav" v-show="flag" @click="scrollback">
      <i class="iconfont icon-cc-top"></i>
    </div>
  </div>
</template>

<script>
//这里可以导入其他文件（比如：组件，工具js，第三方插件js，json文件，图片文件等等）
//例如：import 《组件名称》 from '《组件路径》';

export default {
  //import引入的组件需要注入到对象中才能使用
  components: {},
  data() {
    //这里存放数据
    return {
      flag: false,
    };
  },
  //监听属性 类似于data概念
  computed: {},
  //监控data中的数据变化
  watch: {},
  //方法集合
  methods: {
    scrollshow() {
      if (document.documentElement.scrollTop > 800) {
        this.flag = true;
      } else {
        this.flag = false;
      }
    },
    scrollback() {
      document.documentElement.scrollTop = 0;
    },
  },
  mounted() {
    window.addEventListener("scroll", this.scrollshow, false);
  },
};
</script>
<style lang="less">
.right-aside {
  position: fixed;
  bottom: 137px;
  right: 12px;
  color: #6e6d6b;
  z-index: 10;

  .service_item {
    width: 58px;
    height: 58px;

    img {
      width: 100%;
    }

    &:first-child {
      span {
        position: absolute;
        width: 50px;
        height: 50px;
        left: 4px;
        bottom: 123px;
        background: red;
        border-radius: 50%;
        animation: living 3s linear infinite;
        z-index: -1;

        &:nth-child(2) {
          animation-delay: 1.5s;
        }
      }
    }
  }
  .commom-nav {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    position: fixed;
    bottom: 11%;
    background-color: #fff;
    right: 16px;
    z-index: 1999;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 1px 1px 2px 0 rgba(0, 0, 0, 0.05);

    .icon-cc-top {
      font-size: 1.8rem;
      color: #333;
      margin-top: 3px;
    }
  }
}
@keyframes living {
  0% {
    transform: scale(1);
    opacity: 0.5;
  }

  50% {
    transform: scale(1.5);
    opacity: 0;
  }

  100% {
    transform: scale(1);
    opacity: 0.5;
  }
}
</style>